<template>
    <div>
        <h1>会员等级添加</h1>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>会员等级名称</td>
                    <td>
                        <input type="text" v-model="info.huiYuanTypeName" >
                    </td>

                </tr>
                <tr>
                    <td>会员等级状态</td>
                    
                   
                    <td><input type="radio" v-model="info.huiYuanTypeStare" value="1">启用
                        <input type="radio" v-model="info.huiYuanTypeStare" value="0">禁用
                       
                    </td>
              
                </tr>
                <tr>
                    <td></td>
                    <td>
                        <button @click="AddHuiYuanType">添加</button>
                    </td>
                </tr>
            </tbody>
        </table>    
        
    </div>
</template>

<script setup lang="ts">
import { ref, reactive, onMounted } from 'vue';
import axios from 'axios';
import moment from 'moment';
import { useRouter, useRoute } from 'vue-router';

const router = useRouter();
const route = useRoute();
let info: any = reactive({
    huiYuanTypeName: "",
  huiYuanTypeStare: "",
 
})
const AddHuiYuanType=()=>{
    if(info.huiYuanTypeName==''){
        alert('请输入会员等级名称')
        return; 
    }
    if(info.huiYuanTypeStare==''){
        alert('请选择会员等级状态')
        return; 
    }
 axios({
     url: '/api/HuiYuan/AddHuiYuanType',
     method: 'post',
     data: info
 }) 
.then((res)=>{
     if(res.data=1){
        alert('添加成功')
        router.push('/ShowHuiYuanType')
     }
     else{
         alert('添加失败')
         return;
     }
  })
}

</script>

<style scoped>

</style>